<%@page import="java.io.Console"%>
<%@page import="HumanM.PUser"%>
<%@page import="jdbc.*"%>
<%@page import="FunCtion.Board"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>添加板块逻辑处理页面</title>
</head>
<body>

<%
//功能：将版块信息加入数据库
	Board bo=new Board();
  	 DBOUser dbuser=new DBOUser();
 DBOBoard dbbo=new DBOBoard();

   request.setCharacterEncoding("UTF-8");
   bo.setBoard_name(request.getParameter("board_name"));//板块姓名
	int Bid=Integer.parseInt(request.getParameter("board_of"))  ;//所属板块ID   如果为0说明是主版块
	int usid=Integer.parseInt(request.getParameter("board_boarder"));//版主的ID
	bo.setBoard_info(request.getParameter("board_info"));//板块说明
	
	//查询版主用户姓名
	dbuser.Q_user_info_ofid(usid);
	/**首先，添加属性到对象  **/
//1.是否为主版块
if(Bid==0){
	bo.setBoard_idMother(true);
	}else{
		bo.setBoard_idMother(false);
		bo.setBoard_bid(Bid);
	}
//2.添加版主信息
	bo.board_master = dbuser.Q_user_info_ofid(usid);
	
	/**然后，将对象插入到数据库  **/
	//查询最大编号
	int id=dbbo.QueryID(); //给板块赋的编号值
Board bo1=new Board(++id,bo.board_idMother,Bid,bo.board_name,bo.board_info,bo.board_master);
	dbbo.Insert_Board_data(bo1);
	
	response.sendRedirect("../content_board.jsp");
%>


</body>
</html>